// #include <Arduino.h>
// #include "esp_system.h"

// // const int button = LED_BUILTIN;         //gpio to use to trigger delay
// const int wdtTimeout = 5000;  //time in ms to trigger the watchdog
// hw_timer_t *timer = NULL;
// long startTime = millis(); //启动时间

// void IRAM_ATTR resetModule() {
//   ets_printf("1 second after reboot\n"); //1秒后重启
//   delay(1000); //simulate work
//   esp_restart();
// }

// void setup() {
//   Serial.begin(9600);
//   Serial.println();
//   Serial.println("running setup");

//   pinMode(KEY_BUILTIN, INPUT_PULLUP);                    //init control pin
//   timer = timerBegin(0, 80, true);                  //timer 0, div 80
//   timerAttachInterrupt(timer, &resetModule, true);  //attach callback
//   timerAlarmWrite(timer, wdtTimeout * 1000, false); //set time in us
//   timerAlarmEnable(timer);                          //enable interrupt 

// }




// void loop() {
//   long loogTime = 0; //持续时间
//   Serial.println("running main loop");

//   //while button is pressed, delay up to 3 seconds to trigger the timer
//   // Serial.println(digitalRead(KEY_BUILTIN));
//   if (digitalRead(KEY_BUILTIN)==0) {
//     Serial.println("press key 喂狗");
//     delay(100);
//     timerWrite(timer, 0); //喂狗 reset timer (feed watchdog)
    
//   }
//   delay(1000); //simulate work
//   loogTime = millis() - startTime;
  
//   Serial.print("loop time is = ");
//   Serial.println(loogTime); //3秒后不喂狗就要重启
// }
